<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:include="head :: head">
    <link rel="import" href="../head.html"/>
</head>
<body class="nav-md">
<link rel="stylesheet" href="../../static/css/module_css/style.css"
      th:href="@{/css/module_css/style.css}"/>
<div class="container body">
    <div class="main_container">
        <div id="teamworking_letree" class="col-md-3 left_col" th:replace="letree :: letree">
        </div>
        <!-- top navigation  -->
        <div class="top_nav" th:include="header :: top">

        </div>
        <div class="right_col" role="main">
        </div>
    </div>
</div>
<input type="hidden" id="test">

<footer th:include="head :: footer">

</footer>

<script rel='stylesheet' src="../../static/supermap/libs/SuperMap.Include.js"
        th:src="@{/supermap/libs/SuperMap.Include.js}"></script>

<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    $(function () {//默认加载数据的table--(work_list)
        //将登陆人姓名存入sessionStorage中
        sessionStorage.setItem("userName", [[${empName}]]);
        document.cookie = "userName=[[${empName}]];"
        $.goTo(/*[[@{/eventTurn/toZWorkList}]]*/"./work_list.html");
    });

    //领取到个人任务
    function Receive(obj) {
        var eventId = $(obj).attr("id");
        $.post("/event/claim", {"eventId": eventId}, function (result) {
            if ("success" == result) {
                $.goTo(/*[[@{/eventTurn/toZWorkList}]]*/"./work_list.html");
                $.MsgBox.Alert("提示", "领取成功，可在个人任务中查询此任务!");

            } else {
                $.goTo(/*[[@{/eventTurn/toZWorkList}]]*/"./work_list.html");
                $.MsgBox.Alert("提示", "领取失败,请联系管理员!");

            }
        });
    }

    //展示时间轴附件信息
    function getEventAccessory(id) {
        var img = "";
        var mp4 = "";
        var mp3 = "";

        $.post("/event/getEventAccessory", {"eventId": id}, function (result) {
            $("#mp3").empty();
            $("#mp4").empty();
            $("#eventImg").empty();
            $.each(result, function (index, item) {
                if (item.accessoryType == "1") {
                    img += "<div class='item '>" +
                        "<img src='" + item.accessoryPath + "' alt='...'>" +
                        "<div class='carousel-caption'>" +
                        "</div>" +
                        "</div>"
                }

                if (item.accessoryType == "3") {
                    //视频
                    mp4 += "<video width='320' height='240' controls>" +
                        " <source  src='" + item.accessoryPath + "' width='352' height='264' controls autobuffer type='video/mp4'>" +
                        "       您的浏览器不支持 HTML5 video 标签。" +
                        "</video>"
                }

                if (item.accessoryType == "2") {
                    //音频
                    mp3 += "<audio controls>" +
                        "<source  height='100' width='352' src='" + item.accessoryPath + "' type='audio/ogg/amr'>" +
                        " 您的浏览器不支持 audio 元素。" +
                        "</audio>"
                }
            });

            $("#mp3").append(mp3);
            $("#mp4").append(mp4);
            $("#eventImg").append(img);
            $("#eventImg").find(".item").eq(0).addClass("active");
            $("#ModalInfo").modal('show');
        });
    }

    function assignment(obj) {
        var eventId = $(obj).attr("id");
        var lng = $(obj).attr("lng");
        var lat = $(obj).attr("lat");

        //清空图层
        vector.removeAllFeatures();
        if (marker != undefined) { markerlayer.removeMarker(marker);}
        var point = new SuperMap.Geometry.Point(lng, lat);
        //给点定义样式，此处是超图的矢量图
        pointVector = new SuperMap.Feature.Vector(point);
        pointVector.style = {
            fillColor: "#fff", //内圈颜色
            strokeColor: "#fff", //外圈颜色
            pointRadius: 1 //点的大小
        };
        //图片大小限制
        var size = new SuperMap.Size(44, 33);
        //偏移量
        var icon = new SuperMap.Icon('../images/1111.gif', size);
        marker = new SuperMap.Marker(new SuperMap.LonLat(lng, lat), icon);
        //打点
        vector.addFeatures(pointVector);
        markerlayer.addMarker(marker);

        $("#test").val(eventId);
        $.post("/event/findCommentByObjecId", {"eventId": eventId}, function (result) {
            var content = "";
            var str = new Array()
            $.each(result, function (index, item) {
                str = item.userId.split("_");
                content += "<li style='font-size: 14px;'> <div class='block'><div class='tags'><a class='tag'>";
                if (str[0] != null) {
                    content += "     <span>" + str[1] + "</span>";
                } else {
                    content += "     <span>未设置</span>";
                }
                content += "     </a> </div>";
                content += "    <div class='block_content'> <h2 class='title' style='font-size: 14px; ' >";
                if (str[2] != null) {
                    content += "     <span style='font-weight: 600;'>部门名称：</span><a>" + str[0] + "</a>";
                } else {
                    content += "      <span style='font-weight: 600;'>部门名称：</span><a>未设置</a>";
                }
                content += "     </h2> <div class='byline' style='font-style: inherit; color: #5A738E;'>";
                if (str[1] != null) {
                    content += "    处 &nbsp;理 &nbsp;&nbsp;人：<a>" + str[2] + "</a>";
                } else {
                    content += "     处理人：<a>未设置</a>";
                }
                content += "    </div>";
                content += "   <p class='excerpt'>处理意见：" + item.fullMessage + " <a>";
                if (str[3] != "" && str[3] != null) {
                    content += '       <button type="button" onclick="getEventAccessory(\'' + str[3] + '\')" class="btn btn-primary btn-lg" style="float: right" > 附件详情</button>';
                }
                content += "     </a> </p></div></div></li>";
            })
            $("#commentTree").empty();
            $("#commentTree").append(content);
        });

        $.post("/event/eventInfo", {"eventId": eventId}, function (result) {
            $("#empName1").val(result.eventTitle);//人员
            $("#eventTypeId").val(result.val);//类别
            $("#gridId").val(result.gridName);//网格
            $("#eventLocation").val(result.eventLocation);//地址
            $("#lng").val(result.lng);
            $("#lat").val(result.lat);
            $("#eventCode").val(result.eventCode);
            $("#eventContent").val(result.eventContent);
        });
    }

    function up(number) {//分页跳转，上一页
        /*[+
         var number = parseInt(number);
         $.goTo("/eventTurn/toZWorkList?page="+number);
         +]*/
    }
    function next(number) {//分页跳转，下一页
        /*[+
         var number = parseInt(number) + 2;
         $.goTo("/eventTurn/toZWorkList?page="+number);
         +]*/
    }
    function pageTo(page) {
        /*[+
         var number = page;
         $.goTo("/eventTurn/toZWorkList?page=" + number);
         +]*/

    }
    /*]]>*/
</script>
</body>
</html>